import java.io.*;
import java.util.*;

public class FindGateWays {

	public static void main(String[] args) throws IOException {
		String [] par=new String[]{"-d","google.com"};
		
		Process result = Runtime.getRuntime().exec("tracert -d www.amazon.com");

		BufferedReader output = new BufferedReader(new InputStreamReader(result.getInputStream()));
		String thisLine = output.readLine();
		StringTokenizer st = new StringTokenizer(thisLine);
		st.nextToken();
		String gateway = st.nextToken();
		System.out.printf("The gateway is %s\n", gateway);
	}
}
